<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<ui:insert name="header">
	<ui:include src="template/header.xhtml" />
</ui:insert>
</head>
<body>
	<f:view>
		<ui:include src="template/banner.xhtml" />

		<h:form id="form">

			<h:outputFormat value="#{bundle.CartItemCount}">
				<f:param value="#{cart.numberOfItems}" />
			</h:outputFormat>

			<br />
			<br />
			<h:commandLink id="clear" action="#{cart.clear}" immediate="true"
				rendered="#{cart.numberOfItems > 0}">
				<h:outputText value="#{bundle.ClearCart}" />
			</h:commandLink>
			&nbsp;
			<h:commandLink id="buy" action="#{shoppingcart.checkout}" immediate="true"
				rendered="#{cart.numberOfItems > 0}">
				<h:outputText value="#{bundle.Buy}" />
			</h:commandLink>
			<br />
			<br />
			<h:dataTable id="items" captionClass="list-caption"
				columnClasses="list-column-center, list-column-left,
                          list-column-right, list-column-center"
				footerClass="list-footer" headerClass="list-header"
				rowClasses="list-row-even, list-row-odd"
				styleClass="list-background" summary="#{bundle.ShoppingCart}"
				value="#{cart.items}" var="item">

				<h:column headerClass="list-header-left">
					<f:facet name="header">
						<h:outputText value="#{bundle.ItemQuantity}" />
					</f:facet>
					<h:inputText id="quantity" size="4" value="#{item.quantity}">
						<f:validateLongRange minimum="1" />
					</h:inputText>
					<h:message for="quantity" />
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="#{bundle.ItemTitle}" />
					</f:facet>
					<h:commandLink action="#{shoppingcart.details}">
						<h:outputText value="#{item.item.title}" />
					</h:commandLink>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="#{bundle.ItemPrice}" />
					</f:facet>
					<h:outputText value="#{item.item.price}">
						<f:convertNumber type="currency" />
					</h:outputText>
				</h:column>

				<h:column>
					<h:commandButton id="remove" action="#{shoppingcart.remove}"
						value="#{bundle.RemoveItem}" />
				</h:column>

				<f:facet name="footer">
					<h:panelGroup>
						<h:outputText value="#{bundle.Subtotal}" />
						<h:outputText value="#{cart.total}">
							<f:convertNumber type="currency" />
						</h:outputText>
					</h:panelGroup>
				</f:facet>
				<f:facet name="caption">
					<h:outputText value="#{bundle.Caption}" />
				</f:facet>
			</h:dataTable>
			<h:commandLink id="update" action="#{shoppingcart.update}"
				immediate="false">
				<h:outputText value="#{bundle.UpdateQuantities}" />
			</h:commandLink>
		</h:form>
	</f:view>
</body>
</html>